"""
1）使用列表推导式，快速创建一个元素为：1、2…10的列表
2）使用列表推导式，快速创建一个元素为：2、4、6、8、10…20的列表
   使用range步长，也可以带有if
3）使用列表推导式，快速创建一个元素为：
[(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2), (2, 0), (2, 1), (2, 2)]的列表
   使用多个for
4）创建一个字典：字典key是1-5数字，value是这个数字的2次方
5）将两个列表合并为一个字典
   li1= ['name', 'age', 'gender']
li2 = ['Tom', 20, 'man']
6）提取字典中目标数据
   counts = {'MBP': 268, 'HP': 125, 'DELL': 201, 'Lenovo': 199, 'acer': 99}
 需求：提取上述电脑数量大于等于200的字典数据
7）创建一个集合，数据为下方列表的2次方
   li3 = [1, 1, 2]
"""


# list1=[i for i in range(1,11)]
# print(list1)
# list2=[i for i in range(2,21,2)]
# print(list2)
# list3=[i for i in range(2,21)if i % 2==0]
# print(list3)
# list4=[(i,j) for i in range(0,3) for j in range(0,3)]
# print(list4)
# list5=[{i:i**2 for i in range(1,6)}]
# print(list5)
# li1= ['name', 'age', 'gender']
# li2 = ['Tom', 20, 'man']
# list6=[{li1[i]:li2[i] for i in range(0,3)} ]
# print(list6)
# counts = {'MBP': 268, 'HP': 125, 'DELL': 201, 'Lenovo': 199, 'acer': 99}
# list7=[{k:j for k,j in counts.items() if(j>=200)}]
# print(list7)
# li3 = [1, 1, 2]
# list8=[{i**2 for i in li3}]
# print(list8)

"""
1）过滤出长度大于3的人名
name = ['tom','lily','jacks','Pe','Steven']
2）得到嵌套列表中每个列表的最后一个元素
list1 = [[1,2,3],[4,5,6],[7,8,9]]
3）员工工资>5000的人加200，否则加500
dict1 = {'name':'张三','salary':6000}
dict2 = {'name':'李四','salary':8000}
dict3 = {'name':'王五','salary':4000}
dict4 = {'name':'吴二','salary':3000}
list2 = [dict1,dict2,dict3,dict4]
4）找到分数60分以下的人姓名
scores = {
      "Rick Sanchez": 70,
      "Morty Smith": 35,
      "Summer Smith": 82,
      "Jerry Smith": 23,
      "Beth Smith": 98
    }

"""
name = ['tom','lily','jacks','Pe','Steven']
list1=[i for i in name if len(i)>=3]
print(list1)


li1 = [[1,2,3],[4,5,6],[7,8,9]]
list2=[i[-1] for i in li1]
print(list2)


dict1 = {'name':'张三','salary':6000}
dict2 = {'name':'李四','salary':8000}
dict3 = {'name':'王五','salary':4000}
dict4 = {'name':'吴二','salary':3000}
li2 = [dict1,dict2,dict3,dict4]
list2=[(i['name'],i.get('salary')+200) if i.get('salary')>5000 else (i['name'],i.get('salary')+500) for i in li2   ]
print(list2)


scores = {
      "Rick Sanchez": 70,
      "Morty Smith": 35,
      "Summer Smith": 82,
      "Jerry Smith": 23,
      "Beth Smith": 98
    }
list3=[{i for i,j in scores.items() if(j<=60)}]
print(list3)